<% 
  column_names  = Document.column_names 
  fkeys_names   = Document.reflections.values.every(:primary_key_name)
  assoc_names   = Document.reflections.values.every(:name) 
  columns = column_names - fkeys_names.join(",").split(",") + assoc_names.join(",").split(",") - ["id"]
%>

<% for column in columns %>
  <div id="<%= column %>" style="cursor:move; color:rgb(0,0,102); padding-left:2px; padding-right:2px; float:left; margin:4px;  font-weight: bold;">
    <%= column.titleize %>
  </div>
  <%= draggable_element("#{column}", :revert => false) %>
<% end %>